package com.sanchunhui.psc.data.respository

import com.sanchunhui.psc.data.api.UploadApi
import com.sanchunhui.psc.data.net.RetrofitFactory
import com.sanchunhui.psc.data.protocol.BaseResp
import com.sanchunhui.psc.data.protocol.ResponseInfo
import com.sanchunhui.psc.data.protocol.TokenReq
import okhttp3.MultipartBody
import okhttp3.RequestBody
import org.json.JSONObject
import retrofit2.http.Body
import rx.Observable
import javax.inject.Inject

/*
    上传相关 数据层
 */
class UploadRepository @Inject constructor(){
    /*
        获取七牛云上传凭证
     */
    fun getUploadToken(): Observable<BaseResp<String>> {
        return RetrofitFactory.instance.create(UploadApi::class.java).getUploadToken()
    }

    /*
        上传用户头像
     */
    fun uploadUserHead(
        token: RequestBody,
        file: MultipartBody.Part
    ): Observable<ResponseInfo> {
        return RetrofitFactory.instance.create(UploadApi::class.java).uploadUserHead(token,file)
    }


}
